<?php 
ob_start();
include_once 'Model/Player.php';

session_start();

if (!$_SESSION['player']) {       
     	$player = Player::newWithRandomTeam();
        
        $_SESSION['player'] = $player;

}else {
        $player = $_SESSION['player'];
        
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                                        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  <style type="text/css">
    html { height: 100% }
    body { height: 100%; margin: 0px; padding: 0px }
    #map_canvas { height: 100% ; width:100%;}

	.factionInfos {
		float: left;
		margin-right: 10px;
	
	}

        #loadTime{
        position: absolute;
        right: 751px;
        top: 249px;
        width: 304px;
}


        #shadowing
        {
          display: none;
          position: fixed;
          top: 0%;
          left: 0%;
          width: 100%;
          height: 100%;
          background-color: #CCA;
          z-index:10;
          opacity:0.5;
          filter: alpha(opacity=50);
        }

#teamInfos{
	height: 30px;
	width:100%;
	position: absolute;
	left: 5px;
	bottom: 5px;
	color : white;
	font-size: 14px;
	background-image:url(Medias/barreInfo.png);
	text-align: center;
}

  </style>

        <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
        <script type="text/javascript" src="http://gmaps-samples-v3.googlecode.com/svn/trunk/xmlparsing/util.js"></script>
        <script type="text/javascript" src="Js/geolocation.js"></script>
 
</head>

 
<body>

<div id="map_canvas">

</div>

		<div id="teamInfos">
			<span>You are in the <?php echo $player->team()->color()?> team !</span>
		</div>

<?php 
	$owner = null;
	$teams = OPDatabase::allTeams();
	foreach ($teams as $team) {
		if ($team->occupation() > 50) {
			$owner = $team->color();
			
		}
		
	}

?>

<script type="text/javascript">
initialize(<?php echo "'$owner'"; ?>);

</script>

</body>
</html>